
package cesdentalrecord.dao.view;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import test.InitTorque;

import cesdentalrecord.dao.controller.SearchAStudentController;
import cesdentalrecord.dao.Student;


public class SearchAStudentView {

	/**
	 * @param args
	 */
	
	SearchAStudentController sasc = new SearchAStudentController();
	
	public void promptSuccessfulSearch(List<Student> s){
		System.out.println("Search results: " + "(" + s.size() + ")");
		
		for(Student st : s){
		System.out.println(st.getSurname() + ", " + st.getFirstname() + " " + st.getMi());
		}
	}
	
/*	public void setSurname(String surname){
		this.surname = surname;
	}
	
	public void setFirstName(String firstName){
		this.firstName = firstName;
	}
	
	public void setMI(String mi){
		this.mi = mi;
	}*/
	
	public List<Student> sendSearchAStudentRequest(String surname, String firstName, String mi) throws IOException {
		// TODO Auto-generated method stub
		InitTorque it = new InitTorque();
		it.init();
		
	//	String surname;
	//	String firstName;
	//	String mi;
		
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		
		SearchAStudentView sasv = new SearchAStudentView();
		
		List<Student> s = new ArrayList<Student>();
		
/*		System.out.println("input Surname: ");
		surname = (input.readLine());
		
		System.out.println("input Firstname: ");
		firstName = (input.readLine());
		
		System.out.println("input Middle Initial: ");
		mi =(input.readLine());
	*/	
		s = sasc.validateSearchAStudentEntries(surname, firstName, mi);
		
		if(s.isEmpty()){
			System.out.println("No results found");
		}
		
		else sasv.promptSuccessfulSearch(s);
		
		return s;
	}
	

}
